﻿using System;
using System.Linq;
using System.Linq.Expressions;
using NHibernate;
using Remotion.Linq.Clauses.ExpressionTreeVisitors;

namespace FluentDml
{
    /// <summary>
    /// provides DML extensions against the Session 
    /// </summary>
    public static class FluentDmlExtensions
    {
        /// <summary>
        /// Apply a set based update
        /// </summary>
        /// <typeparam name="T">the type to apply the set based action on</typeparam>
        /// <param name="session">session to use</param>
        /// <param name="where">the where clause to apply</param>
        public static Update<T> Update<T>(this ISession session, Expression<Func<T, bool>> where)
        {
            return new Update<T>(session, where);
        }

        /// <summary>
        /// Apply a set based delete
        /// </summary>
        /// <typeparam name="T">the type to apply the set based action on</typeparam>
        /// <param name="session">session to use</param>
        /// <param name="where">the where clause to apply</param>
        public static Delete<T> Delete<T>(this ISession session, Expression<Func<T, bool>> where)
        {
            return new Delete<T>(session, where);
        }
    }
}
